fix: make sonar_token_variable_name parameter work#40
fix: make sonar_token_variable_name parameter work#40YaraslauZhylko wants to merge 1 commit intoSonarSource:masterfrom
sonar_token_variable_name parameter work#40Conversation
|
Hi @YaraslauZhylko , Thank you very much for this fix 🚀 I have a question regarding the usage of this parameter. We are wondering how useful it is, like what is your test case? Could you name your variable SONAR_TOKEN or do you have a specific reason not to? In the meantime, I have open another PR where I cherry picked your fix and added a test for the param as well as a couple of minor fixes to your change. |
|
Hi @antoine-vinot-sonarsource!
We have a single CircelCI context called So we need an extra step to pass the token to the scanner like this: - run:
name: Export PROJECT_SONAR_TOKEN as SONAR_TOKEN
command: echo "export SONAR_TOKEN=${PROJECT_SONAR_TOKEN}" >> "$BASH_ENV"Instead of doing: - sonarcloud/scan
sonar_token_environment_variable: PROJECT_SONAR_TOKENIf you remove the parameter, we'll just keep doing this or split this particular context ito project-oriented ones. |
|
@YaraslauZhylko Thank you for the clarification.
So, all in all, we don't believe the use case for this parameter is worth maintaining it. |
Problem
The
sonar_token_variable_nameparameter is declared in the docs but is not actually used by the orb. The script still strictly requires the token to be stored inSONAR_TOKENvariable.Solution
Make the script use
SONAR_TOKEN_VARIABLE_NAMEall the time.If the user does not provide the value, it defaults to
SONAR_TOKENas planned.